﻿<%@ Page Title="" Language="C#" MasterPageFile="BGMasterPage.master" AutoEventWireup="true"
    CodeFile="GroupList.aspx.cs" Inherits="GroupList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cphHeader" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphContent" runat="Server">
    <table id="jqGridId">
    </table>
    <div id="pager">
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Bottom" runat="Server">
    <script type="text/javascript">
        $(function () { 
        $("#jqGridId").jqGrid({   
        url: "Handler/GroupHandler.ashx?mode=getDataList",
        editurl:"Handler/GroupHandler.ashx?mode=edit",
        datatype:"json", //为local时初始化不加载，支持json，xml等   
        mtype: "POST",   shrinkToFit:true,autoload:false,
        colNames:['编号', '分组名称'], //表头   
        colModel:[ //这里会根据index去解析jsonReader中root对象的属性，填充cell   
            {name:'ID', index:'ID', width:55, align:"center",sortable:false,key:true},  
            {name:'Name', index:'Name', width:120, sortable:false,editable: true,edittype:"text",editoptions:{maxlength:"128"}},   
        ],   
        width: $("#jqGridId").parent().width(), //数字 & 'auto','100%'   
        height: $(window).height()-90,   
        rowNum: 100, //每页记录数   
        rowList:[5, 10,50,100], //每页记录数可选列表   
        pager: '#pager', //分页标签divID   
        viewrecords: true, //显示记录数信息，如果这里设置为false,下面的不会显示 recordtext: "第{0}到{1}条, 共{2}条记录", //默认显示为{0}-{1} 共{2}条 scroll: false, //滚动翻页，设置为true时翻页栏将不显示  
        /**这里是排序的默认设置，这些值会根据列表header点击排序时覆盖*/ sortable: false,   
        sortname: "id",   
        sortorder: "desc",   
  
        caption:"分组列表", //显示查询结果表格标题   
        rownumbers: true, //设置列表显示序号,需要注意在colModel中不能使用rn作为index   
        rownumWidth: 20, //设置显示序号的宽度，默认为25   
        multiselect: true, //多选框   
        multiboxonly: true, //在点击表格row时只支持单选，只有当点击checkbox时才多选，需要multiselect=true是有效   
        prmNames : { //如当前查询实体为ware，这些可以在查询对象的superObject中设定   
            page: "wareDetail.page",   
            rows: "wareDetail.rows",   
            sort: "wareDetail.sidx",   
            order: "wareDetail.sord",   
            search: "wareDetail.search"   
        },   
        jsonReader:{ //server返回Json解析设定   
            root: "list", //对于json中数据列表   
            page: "page",   
            total: "totalPage",   
            records: "totalCount",  
            repeatitems: false,   
        }
    });   
    var editOptions={ top: 100, left: ($("#jqGridId").width()-500)/2, width: 500,closeOnEscape: true,reloadAfterSubmit:false,closeAfterEdit:true, afterSubmit: function(response, postdata){
        var data = $.parseJSON(response.responseText);return[data.Result,data.Message,data.ID];
    }};
    $("#jqGridId").jqGrid('navGrid','#pager',{edit:true,add:true,del:true,search:true},editOptions,editOptions,editOptions);//这里设定分页bar显示的信息
    
    });
    </script>
</asp:Content>
